#ifndef __SOUND_H
#define __SOUND_H

#include "libraries.h"

using namespace std;

class Sound
{
    private:
        Mix_Music *mainMenuMusic;
        Mix_Chunk *success;
        Mix_Chunk *failure;

        Mix_Chunk *shoock1;
        Mix_Chunk *shoock2;
        Mix_Chunk *shoock3;
        Mix_Chunk *shoock4;
        Mix_Chunk *shoock5;

    public:
        Sound()
        {
            mainMenuMusic   = NULL;
            success = NULL;
            failure = NULL;
        }

        Sound(const Sound& other)
        {
            //Load music
            mainMenuMusic   = Mix_LoadMUS("Music/kickShock.ogg");

            //Load sounds
            success = Mix_LoadWAV("Sounds/success.wav");
            failure = Mix_LoadWAV("Sounds/failure.wav");
            shoock1 = Mix_LoadWAV("Sounds/shoock1.wav");
            shoock2 = Mix_LoadWAV("Sounds/shoock2.wav");
            shoock3 = Mix_LoadWAV("Sounds/shoock3.wav");
            shoock4 = Mix_LoadWAV("Sounds/shoock4.wav");
            shoock5 = Mix_LoadWAV("Sounds/shoock5.wav");

        }

        ~Sound()
        {
            //Free music
            Mix_FreeMusic(mainMenuMusic);

            //Free sounds
            Mix_FreeChunk(success);
            Mix_FreeChunk(failure);
            Mix_FreeChunk(shoock1);
            Mix_FreeChunk(shoock2);
            Mix_FreeChunk(shoock3);
            Mix_FreeChunk(shoock4);
            Mix_FreeChunk(shoock5);
        }

        void loadSounds()
        {
            //Load music
            mainMenuMusic = Mix_LoadMUS("Music/kickShock.ogg");

            //Load sounds
            success = Mix_LoadWAV("Sounds/success.wav");
            failure = Mix_LoadWAV("Sounds/failure.wav");
            shoock1 = Mix_LoadWAV("Sounds/shoock1.wav");
            shoock2 = Mix_LoadWAV("Sounds/shoock2.wav");
            shoock3 = Mix_LoadWAV("Sounds/shoock3.wav");
            shoock4 = Mix_LoadWAV("Sounds/shoock4.wav");
            shoock5 = Mix_LoadWAV("Sounds/shoock5.wav");
        }

        Mix_Chunk* getSuccess(){return success;}
        Mix_Chunk* getFailure(){return failure;}
        Mix_Chunk* getShoock()
        {
            int selectionChoice = rand()%5+1;
            if      (selectionChoice == 1) return shoock1;
            else if (selectionChoice == 2) return shoock2;
            else if (selectionChoice == 3) return shoock3;
            else if (selectionChoice == 4) return shoock4;
            else if (selectionChoice == 5) return shoock5;
        }
        Mix_Music* getMainMenuMusic  (){return mainMenuMusic;}
};

#endif
